# board = [["5","3",".",".","7",".",".",".","."]
# ,["6",".",".","1","9","5",".",".","."]
# ,[".","9","8",".",".",".",".","6","."]
# ,["8",".",".",".","6",".",".",".","3"]
# ,["4",".",".","8",".","3",".",".","1"]
# ,["7",".",".",".","2",".",".",".","6"]
# ,[".","6",".",".",".",".","2","8","."]
# ,[".",".",".","4","1","9",".",".","5"]
# ,[".",".",".",".","8",".",".","7","9"]]

board=[["8","3",".",".","7",".",".",".","."]
,["6",".",".","1","9","5",".",".","."]
,[".","9","8",".",".",".",".","6","."]
,["8",".",".",".","6",".",".",".","3"]
,["4",".",".","8",".","3",".",".","1"]
,["7",".",".",".","2",".",".",".","6"]
,[".","6",".",".",".",".","2","8","."]
,[".",".",".","4","1","9",".",".","5"]
,[".",".",".",".","8",".",".","7","9"]]


def isValidSudoku(board):
    #数独大小为9*9
    for i in range(9):
        state=[]
        print("i=",i,"board[i]=",board[i])
        for j in range(9):
            if board[i][j]==".":
                continue
            else:
                if board[i][j] not in state:
                    state.append(board[i][j])
                else:
                    return False
    print("通过行检查、、、、、、、、、、、、、、")
    for j in range(9):
        state=[]
        for i in range(9):
            if board[i][j]==".":
                continue
            else:
                if board[i][j] not in state:
                    state.append(board[i][j])
                else:
                    return False
    print("通过列检测............................")
    for i in range(3):
        for j in range(3):
            state=[]
            print(".........................................")
            print("第",i,"行","第",j,"列")
            for m in range(i*3,i*3+3):
                for n in range(j*3,j*3+3):
                    print([m,n])
                    if board[m][n]==".":
                        continue
                    else:
                        if board[m][n] not in state:
                            state.append(board[m][n])
                        else:
                            return False
    return True
print(isValidSudoku(board))

